home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
dump_s1r
/
button.bas
next >
Wrap
BASIC Source File
|
1998-12-20
|
4KB
|
66 lines
Attribute VB_Name = "modButton"
Option Explicit
Public Function CommandToCls(Form As Form) As ComboPack.ButtonMngr
Set CommandToCls = New ComboPack.ButtonMngr
Dim cmd
For Each cmd In Form.Controls
If TypeName(cmd) = "CommandButton" Then
CommandToCls.AddButton cmd.Name, cmd.Caption, cmd.Left, cmd.Top, cmd.Width, cmd.Height, cmd.BackColor, cmd.Container, cmd.Picture
CommandToCls.Buttons(CommandToCls.Count).Enabled = cmd.Enabled
End If
Next
End Function
Public Function BtnMngrToCode(ButtonMngr As ComboPack.ButtonMngr) As String
Dim m_lngLoop As Long
For m_lngLoop = 1 To ButtonMngr.Count
BtnMngrToCode = BtnMngrToCode & "Private WithEvents " & ButtonMngr.Buttons(m_lngLoop).Name & " As ComboPack.Button" & vbCrLf
Next
BtnMngrToCode = BtnMngrToCode & "Private Sub Form_Load()" & vbCrLf
For m_lngLoop = 1 To ButtonMngr.Count
BtnMngrToCode = BtnMngrToCode & "Set " & ButtonMngr.Buttons(m_lngLoop).Name & " = New ComboPack.Button" & vbCrLf
On Error Resume Next
BtnMngrToCode = BtnMngrToCode & "Set " & ButtonMngr.Buttons(m_lngLoop).Name & ".Parent = " & ButtonMngr.Buttons(m_lngLoop).Parent.Name & vbCrLf
On Error GoTo 0
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".Left = " & ButtonMngr.Buttons(m_lngLoop).Left & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".Top = " & ButtonMngr.Buttons(m_lngLoop).Top & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".Height = " & ButtonMngr.Buttons(m_lngLoop).Height & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".Width = " & ButtonMngr.Buttons(m_lngLoop).Width & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".ForeColor = " & ButtonMngr.Buttons(m_lngLoop).ForeColor & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".BackColor = " & ButtonMngr.Buttons(m_lngLoop).BackColor & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".Name = """ & ButtonMngr.Buttons(m_lngLoop).Name & """" & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".Caption = """ & ButtonMngr.Buttons(m_lngLoop).Caption & """" & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".Redraw" & vbCrLf
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".Enabled = " & ButtonMngr.Buttons(m_lngLoop).Enabled & vbCrLf
Next
BtnMngrToCode = BtnMngrToCode & "End Sub" & vbCrLf
BtnMngrToCode = BtnMngrToCode & "Private Sub Form_MouseDown(Button As Integer, Shift as Integer,X As Single, Y As Single)" & vbCrLf
For m_lngLoop = 1 To ButtonMngr.Count
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".MouseDown Button, X, Y" & vbCrLf
Next
BtnMngrToCode = BtnMngrToCode & "End Sub" & vbCrLf
BtnMngrToCode = BtnMngrToCode & "Private Sub Form_MouseMove(Button As Integer, Shift as Integer,X As Single, Y As Single)" & vbCrLf
For m_lngLoop = 1 To ButtonMngr.Count
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".MouseMove Button, X, Y" & vbCrLf
Next
BtnMngrToCode = BtnMngrToCode & "End Sub" & vbCrLf
BtnMngrToCode = BtnMngrToCode & "Private Sub Form_MouseUp(Button As Integer, Shift as Integer,X As Single, Y As Single)" & vbCrLf
For m_lngLoop = 1 To ButtonMngr.Count
BtnMngrToCode = BtnMngrToCode & ButtonMngr.Buttons(m_lngLoop).Name & ".MouseUp Button, X, Y" & vbCrLf
Next
BtnMngrToCode = BtnMngrToCode & "End Sub" & vbCrLf
Dim B1 As Button
Dim B2 As Button
For Each B1 In ButtonMngr
BtnMngrToCode = BtnMngrToCode & "Private Sub " & B1.Name & "_Press()" & vbCrLf
For Each B2 In ButtonMngr
If B2.Name = B1.Name Then
BtnMngrToCode = BtnMngrToCode & B2.Name & ".HasFocus = True" & vbCrLf
Else
BtnMngrToCode = BtnMngrToCode & B2.Name & ".HasFocus = False" & vbCrLf
End If
Next
BtnMngrToCode = BtnMngrToCode & "End Sub" & vbCrLf
Next
End Function